package com.zygame.sdk.view;

import android.content.Context;
import android.graphics.drawable.Drawable;
import android.view.Gravity;
import android.widget.RadioButton;
import android.widget.RadioGroup.LayoutParams;

import com.zygame.sdk.bean.Navibutton;
import com.zygame.sdk.bean.Toolbar;
import com.zygame.sdk.utils.Icons;
import com.zygame.sdk.utils.ImageSelector;
import com.zygame.sdk.utils.phone.AppUtil;
import com.zygame.sdk.utils.res.ResourceUtil;

public class BottomItem extends RadioButton {

	public BottomItem(Context context) {
		super(context);
		// TODO Auto-generated constructor stub
	}

	public BottomItem(Context context, Toolbar toolbar) {
		super(context);
		// TODO Auto-generated constructor stub
		setGravity(Gravity.CENTER);
		Drawable drawable = ImageSelector.radioSelector(context, Icons
				.getInstance().getIconsFromScreen(context,toolbar.src, 0), Icons.getInstance()
				.getIconsFromScreen(context,toolbar.src, 1));
		LayoutParams params = new LayoutParams(0, LayoutParams.FILL_PARENT, 1);
		setLayoutParams(params);
		setButtonDrawable(android.R.color.transparent);
		setBackgroundDrawable(context.getResources().getDrawable(ResourceUtil.getDrawableId(context, "fy_home_btn_bg")));
		setCompoundDrawablesWithIntrinsicBounds(null, drawable, null, null);
		setTextColor(0xFFFFFFFF);  
		setTextSize(10);
		setText(toolbar.name);
		setPadding(0, (int)AppUtil.dpTopx(context, 10), 0, (int)AppUtil.dpTopx(context, 5));
	}

	public BottomItem(Context context, Navibutton navibutton) {
		super(context);
		// TODO Auto-generated constructor stub  
		setGravity(Gravity.CENTER);
		Drawable drawable = ImageSelector.radioSelector(context, Icons
				.getInstance().getIconsFromScreen(context,navibutton.src, 0), Icons.getInstance()
				.getIconsFromScreen(context,navibutton.src, 1));
		LayoutParams params = new LayoutParams(0, LayoutParams.FILL_PARENT, 1);
		setLayoutParams(params);
		// setButtonDrawable(android.R.color.transparent);
		setTextColor(0xFFFFFFFF);
		setTextSize(12);
		setCompoundDrawablesWithIntrinsicBounds(null, drawable, null, null);
		setText(navibutton.name);
	}
}
